import { ColumnProps } from "@/components/ProTable/interface";
import {fileTypeEnum, statusEnum} from "@/config/enums/serviceDict";

export function album(tags: any[]) {
  const columns: ColumnProps[] = [
    { type: "selection", fixed: "left", width: 80 },
    { type: "index", label: "#", width: 80 },
    // { type: "expand", label: "Expand", width: 100 },
    {
      prop: "preview",
      label: "封面",
      width: 150,
    },
    {
      prop: "title",
      label: "标题",
      width: 200,
      search: { el: "input", props: { placeholder: "请输入专辑标题", style: "width: 180px;" } }
    },
    {
      prop: "type",
      label: "类型",
      width: 100,
      enum: fileTypeEnum,
      search: { el: "select", props: { placeholder: "类型", style: "width: 100px" }}
    },
    {
      prop: "tag",
      label: "标签",
      width: 100,
      enum: tags,
      fieldNames: {
        label: 'name',
        value: 'code',
      },
      search: { el: "select", props: { placeholder: "标签", style: "width: 100px" }}
    },
    {
      prop: "description",
      label: "描述",
      width: 240,
    },
    {
      prop: "views",
      label: "浏览量",
      width: 100,
    },
    {
      prop: "sort",
      label: "排序",
      width: 150
    },
    {
      prop: "status",
      label: "状态",
      width: 100,
      enum: statusEnum,
      search: { el: "select", props: { placeholder: "状态", style: "width: 100px;" } }
    },
    {
      prop: "create_time",
      label: "创建时间",
      width: 180,
      search: {
        el: "date-picker",
        key: "dateTimeRange",
        props: { type: "datetimerange", valueFormat: "YYYY-MM-DD HH:mm:ss", clearable: true, style: "width: 240px;" }
      }
    },
    { prop: "operation", label: "操作", fixed: "right", width: 240 }
  ];
  return { columns };
}
